﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="能源消耗月报表.aspx.cs" Inherits="syc.Jidong.能源消耗月报表" %>

<head runat="server">
    <title></title>
    <script type="text/javascript">
        function saveCode(obj) {
            var winname = window.open('', '_blank', 'top=10000');
            var strHTML = document.all.tableExcel.innerHTML;
            winname.document.open('text/html', 'replace');
            winname.document.writeln(strHTML);
            winname.document.execCommand('saveas', '', '能源消耗.xls');
            winname.close();
        }

</script>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>    
    <form id="form1" runat="server">
    <div id="wintop" class="wintop">能源消耗报表</div>
    <asp:Panel ID="Panel1" runat="server" CssClass="panel" GroupingText="查 询">  
        日期设置<br>
        起始日期：<asp:TextBox ID="RiQiStart" runat="server" CssClass="intxt1" Width="120px"></asp:TextBox>
        <img align="middle" alt="" 
            onclick="makecalendar(document.getElementById('RiQiStart').value, document.getElementById('RiQiStart'));" 
            src="/Icons/29.png" /> 结束日期：<asp:TextBox ID="RiQiEnd" runat="server" 
            CssClass="intxt1" Width="120px"></asp:TextBox>
        <img align="middle" alt="" 
            onclick="makecalendar(document.getElementById('RiQiEnd').value, document.getElementById('RiQiEnd'));" 
            src="/Icons/29.png" />
        <br />
        <asp:Button ID="Button1" runat="server" CssClass="wsbutton" 
            onclick="Button1_Click" Text="预览" UseSubmitBehavior="False" />
        <input onclick="saveCode(tableExcel)" type="button" value="导出Excel"  class="wsbutton"/></asp:Panel>
      </div>
   <div id="tableExcel">
        <h1 style="text-align: center;">
            能源消耗月报表</h1>
        <div align="center"> 
       <asp:Label ID="Label1" runat="server" Text="Label" style="text-align: right;">填报日期：<%=DateTime.Now.ToString("yyyy年MM月dd日") %></asp:Label>  
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                style="text-align: left" BorderColor="Black" 
                BorderStyle="Solid" BorderWidth="2px" Width="750px" 
                DataSourceID="SqlDataSource1" onsorting="GridView1_Sorting">
            <Columns>   
                <asp:BoundField DataField="部门名称" HeaderText="部门名称" 
                    SortExpression="部门名称"  >                    
                <ControlStyle BorderColor="Black" BorderStyle="Solid" />
                <FooterStyle BackColor="Black" BorderColor="Black" />
                <HeaderStyle BorderColor="Black" BorderStyle="Solid" /> 
                   <ItemStyle BorderColor="Black" BorderStyle="Solid" 
                    HorizontalAlign="Center" />
                   </asp:BoundField>
                <asp:BoundField DataField="部门单位名称" HeaderText="单位名称" 
                    SortExpression="部门单位名称" >
                <ControlStyle BorderColor="Black" BorderStyle="Solid" />
                <FooterStyle BorderColor="Black" BorderStyle="Solid" />
                <HeaderStyle BorderColor="Black" BorderStyle="Solid" />
                <ItemStyle BorderStyle="Solid" BorderColor="Black" HorizontalAlign="Center"/>
                </asp:BoundField>
                <asp:BoundField DataField="电量" HeaderText="电量(千瓦时)" SortExpression="电量" 
                    ReadOnly="True"  >
                <ControlStyle BorderColor="Black" BorderStyle="Solid" />
                <FooterStyle BackColor="Black" BorderColor="Black" />
                <HeaderStyle BorderColor="Black" BorderStyle="Solid" /> 
                   <ItemStyle BorderColor="Black" BorderStyle="Solid" 
                    HorizontalAlign="Center" />
                   </asp:BoundField>
                <asp:BoundField DataField="电价" HeaderText="电价(元)" SortExpression="电价" 
                    DataFormatString="{0:0.00}" ReadOnly="True">
                <ControlStyle BorderColor="Black" BorderStyle="Solid" />
                <FooterStyle BackColor="Black" BorderColor="Black" />
                <HeaderStyle BorderColor="Black" BorderStyle="Solid" /> 
                <ItemStyle BorderColor="Black" BorderStyle="Solid" HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="自来水" HeaderText="自来水(吨)" SortExpression="自来水" 
                    ReadOnly="True" >
                <HeaderStyle BorderColor="Black" BorderStyle="Solid" />
                <ItemStyle BorderColor="Black" BorderStyle="Solid" HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="水价" HeaderText="水价(元)" 
                    SortExpression="水价" DataFormatString="{0:0.00}" ReadOnly="True" >
                <ControlStyle BorderColor="Black" BorderStyle="Solid" />
                <FooterStyle BackColor="Black" BorderColor="Black" />
                <HeaderStyle BorderColor="Black" BorderStyle="Solid" /> 
                <ItemStyle BorderColor="Black" BorderStyle="Solid" HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="合计" HeaderText="合计(元)" 
                    SortExpression="合计" DataFormatString="{0:0.00}" ReadOnly="True" >
                <ControlStyle BorderColor="Black" BorderStyle="Solid" />
                <FooterStyle BackColor="Black" BorderColor="Black" />
                <HeaderStyle BorderColor="Black" BorderStyle="Solid" /> 
                <ItemStyle BorderColor="Black" BorderStyle="Solid" HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="日期" HeaderText="日期" 
                    SortExpression="日期" Visible="False" >
                <ControlStyle BorderColor="Black" BorderStyle="Solid" />
                <FooterStyle BackColor="Black" BorderColor="Black" />
                <HeaderStyle BorderColor="Black" BorderStyle="Solid" /> 
                   </asp:BoundField>
            </Columns>
            <HeaderStyle BorderColor="Black" BorderStyle="Solid" />
        </asp:GridView>
        </div>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
            SelectCommand=""></asp:SqlDataSource>
    
    </div>

    </form>
</body>
</html>
